package com.hx.base.operations;

/**
 * @author minghuachen
 * @since 2023/12/8 18:01
 */
public class Main {
    public static void main(String[] args) {
        int a = 298;
        System.out.println(Integer.toBinaryString(a));
        System.out.println(Integer.toBinaryString(-a));
        int b = 136;
        System.out.println(Integer.toBinaryString(b));
        int res1 = a & b;

        System.out.println("&运算："+Integer.toBinaryString(res1));
        System.out.println(res1);
        System.out.println("------------------------");


        int value = -2046;
        System.out.println(Integer.toBinaryString(value));

        int tmp = value >>> 16;
        System.out.println(Integer.toBinaryString(tmp));

        int result = value ^ tmp;
        System.out.println(Integer.toBinaryString(result));
        System.out.println(Integer.toBinaryString(15));
        int result1 = result & 15;
        System.out.println(result1);
        System.out.println(Integer.toBinaryString(result1));

        System.out.println("------------------------");
        int result2 = result & 31;
        System.out.println(Integer.toBinaryString(result));
        System.out.println(Integer.toBinaryString(31));
        System.out.println(Integer.toBinaryString(result2));


    }
}
